<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>添加商品一级分类</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="/Public/admin/assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="/Public/admin/assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <script src="/Public/admin/assets/js/echarts.min.js"></script>
    <link rel="stylesheet" href="/Public/admin/assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="/Public/admin/assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="/Public/admin/assets/css/app.css">
    <script src="/Public/admin/assets/js/jquery.min.js"></script>
 <!-- 引用控制层插件样式 -->
    <link rel="stylesheet" href="/Public/tools/php_img_upload/control/css/zyUpload.css" type="text/css">
</head>

<body data-type="widgets">
    <script src="/Public/admin/assets/js/theme.js"></script>
    <div class="am-g tpl-g">
         <!-- 头部 -->
        <header>
            <!-- logo -->
            <div class="am-fl tpl-header-logo">
                <a href="javascript:;"><img src="/Public/admin/assets/img/logo.png" alt=""></a>
            </div>
            <!-- 右侧内容 -->
            <div class="tpl-header-fluid">
                <!-- 侧边切换 -->
                <div class="am-fl tpl-header-switch-button am-icon-list">
                    <span>

                </span>
                </div>
                <!-- 搜索 -->
                <div class="am-fl tpl-header-search">
                    <form class="tpl-header-search-form" action="javascript:;">
                        <button class="tpl-header-search-btn am-icon-search"></button>
                        <input class="tpl-header-search-box" type="text" placeholder="搜索内容...">
                    </form>
                </div>
                <!-- 其它功能-->
                <div class="am-fr tpl-header-navbar">
                    <ul>
                        <!-- 欢迎语 -->
                        <li class="am-text-sm tpl-header-navbar-welcome">
                            <a href="javascript:;">欢迎你, <span><?php echo (session('ADMINNAME')); ?></span> </a>
                        </li>

                        <!-- 新邮件 -->
                        <li class="am-dropdown tpl-dropdown" data-am-dropdown>
                            <a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
                                <i class="am-icon-envelope"></i>
                                <span class="am-badge am-badge-success am-round item-feed-badge">4</span>
                            </a>
                            <!-- 弹出列表 -->
                            <ul class="am-dropdown-content tpl-dropdown-content">
                                <li class="tpl-dropdown-menu-messages">
                                    <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                        <div class="menu-messages-ico">
                                            <img src="/Public/admin/assets/img/user04.png" alt="">
                                        </div>
                                        <div class="menu-messages-time">
                                            3小时前
                                        </div>
                                        <div class="menu-messages-content">
                                            <div class="menu-messages-content-title">
                                                <i class="am-icon-circle-o am-text-success"></i>
                                                <span>夕风色</span>
                                            </div>
                                            <div class="am-text-truncate"> Amaze UI 的诞生，依托于 GitHub 及其他技术社区上一些优秀的资源；Amaze UI 的成长，则离不开用户的支持。 </div>
                                            <div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
                                        </div>
                                    </a>
                                </li>

                                <li class="tpl-dropdown-menu-messages">
                                    <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                        <div class="menu-messages-ico">
                                            <img src="/Public/admin/assets/img/user02.png" alt="">
                                        </div>
                                        <div class="menu-messages-time">
                                            5天前
                                        </div>
                                        <div class="menu-messages-content">
                                            <div class="menu-messages-content-title">
                                                <i class="am-icon-circle-o am-text-warning"></i>
                                                <span>禁言小张</span>
                                            </div>
                                            <div class="am-text-truncate"> 为了能最准确的传达所描述的问题， 建议你在反馈时附上演示，方便我们理解。 </div>
                                            <div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
                                        </div>
                                    </a>
                                </li>
                                <li class="tpl-dropdown-menu-messages">
                                    <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                        <i class="am-icon-circle-o"></i> 进入列表…
                                    </a>
                                </li>
                            </ul>
                        </li>

                        <!-- 新提示 -->
                        <li class="am-dropdown" data-am-dropdown>
                            <a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
                                <i class="am-icon-bell"></i>
                                <span class="am-badge am-badge-warning am-round item-feed-badge"><?php echo ($msgnumber); ?></span>
                            </a>

                            <!-- 弹出列表 -->
                            <ul class="am-dropdown-content tpl-dropdown-content">
                                <?php if(is_array($msglistdata)): $i = 0; $__LIST__ = $msglistdata;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li class="tpl-dropdown-menu-notifications">
                                    <a href="/Admin/Order/index" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <div class="tpl-dropdown-menu-notifications-title">
                                            <i class="am-icon-line-chart"></i>
                                            <span> <?php echo ($vo["cnt"]); ?></span>
                                        </div>
                                        <div class="tpl-dropdown-menu-notifications-time">
                                            <?php echo ($vo["time"]); ?> 
                                        </div>
                                    </a>
                                </li><?php endforeach; endif; else: echo "" ;endif; ?>
                                
                                <!-- <li class="tpl-dropdown-menu-notifications">
                                    <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <div class="tpl-dropdown-menu-notifications-title">
                                            <i class="am-icon-star"></i>
                                            <span> 有3个来自人事部的消息</span>
                                        </div>
                                        <div class="tpl-dropdown-menu-notifications-time">
                                            30分钟前
                                        </div>
                                    </a>
                                </li>
                                <li class="tpl-dropdown-menu-notifications">
                                    <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <div class="tpl-dropdown-menu-notifications-title">
                                            <i class="am-icon-folder-o"></i>
                                            <span> 上午开会记录存档</span>
                                        </div>
                                        <div class="tpl-dropdown-menu-notifications-time">
                                            1天前
                                        </div>
                                    </a>
                                </li> -->


                                <li class="tpl-dropdown-menu-notifications">
                                    <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                        <i class="am-icon-bell"></i> 进入列表…
                                    </a>
                                </li>
                            </ul>
                        </li>

                        <!-- 退出 -->
                        <li class="am-text-sm">
                            <a href="/Admin/Index/adminLoginout">
                                <span class="am-icon-sign-out"></span> 退出
                            </a>
                        </li>
                    </ul>
                </div>
            </div>

        </header>
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title">
                    选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <!-- 侧边导航栏 -->
        <div class="left-sidebar">
            <!-- 用户信息 -->
            <div class="tpl-sidebar-user-panel">
                <div class="tpl-user-panel-slide-toggleable">
                    <div class="tpl-user-panel-profile-picture">
                        <?php if(($_SESSION['ADMINIMG']) == ""): ?><img src="/Public/admin/assets/img/user04.png" alt="">
                        <?php else: ?>
                        <img src="<?php echo (session('ADMINIMG')); ?>" alt=""><?php endif; ?>
                        
                    </div>
                    <span class="user-panel-logged-in-text">
              <i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
              <!-- 禁言小张 -->
              <?php echo (session('ADMINNAME')); ?>
          </span>
                    <a href="javascript:;" class="tpl-user-panel-action-link"> <span class="am-icon-pencil"></span> 账号设置</a>
                </div>
            </div>

            <!-- 菜单 -->
            <ul class="sidebar-nav">
                <li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
                <li class="sidebar-nav-link">
                    <a href="/Admin/Index/index.html" class="active">
                        <i class="am-icon-home sidebar-nav-link-logo"></i> 首页
                    </a>
                </li>
                 <li class="sidebar-nav-link">
                    <a href="/Admin/Admincenter/index.html" >
                        <i class="am-icon-cog sidebar-nav-link-logo" ></i> 个人中心
                    </a>
                </li>

                 <li class="sidebar-nav-link">
                    <a href="/Admin/User/index.html">
                        <i class="am-icon-table sidebar-nav-link-logo"></i> 商城用户管理
                    </a>
                </li>

                <li class="sidebar-nav-link">
                    <a href="javascript:;" class="sidebar-nav-sub-title">
                        <i class="am-icon-gift sidebar-nav-link-logo"></i> 商品分类管理
                        <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                    </a>
                    <ul class="sidebar-nav sidebar-nav-sub">
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Sort/managesort.html">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 商品一级分类列表
                            </a>
                        </li>

                        <li class="sidebar-nav-link">
                            <a href="/Admin/TwoSort/managetwosort.html">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 商品二级分类列表
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="sidebar-nav-link">
                    <a href="/Admin/Goods/managegoods.html">
                        <i class="am-icon-cart-arrow-down sidebar-nav-link-logo"></i> 商品管理
                    </a>
                </li>

                <li class="sidebar-nav-link">
                    <a href="/Admin/Order/index">
                        <i class="am-icon-table sidebar-nav-link-logo"></i> 订单管理
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="/Admin/Index/tables.html">
                        <i class="am-icon-table sidebar-nav-link-logo"></i> 表格
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="/Admin/Index/calendar.html">
                        <i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="/Admin/Index/form.html">
                        <i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单

                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="/Admin/Index/chart.html">
                        <i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表

                    </a>
                </li>

           <!--      <li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
                <li class="sidebar-nav-link">
                    <a href="javascript:;" class="sidebar-nav-sub-title">
                        <i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
                        <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                    </a>
                    <ul class="sidebar-nav sidebar-nav-sub">
                        <li class="sidebar-nav-link">
                            <a href="/Admin/Index/table-list.html">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
                            </a>
                        </li>

                        <li class="sidebar-nav-link">
                            <a href="/Admin/Index/table-list-img.html">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
                            </a>
                        </li>
                    </ul>
                </li> -->
              
               
              

            </ul>
        </div>

         

        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">

            <div class="container-fluid am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        <?php if(($sorttag) == ""): ?><div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 商品分类管理 <small>新增一级分类</small></div>
                        <p class="page-header-description">你可以添加新的商品一级分类信息并保存</p>
                        <?php else: ?>
                        <div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 商品分类管理 <small>编辑一级分类</small></div>
                        <p class="page-header-description">你可以编辑商品一级分类信息并保存</p><?php endif; ?>
                        
                    </div>
                    <div class="am-u-lg-3 tpl-index-settings-button">
                        
                    </div>
                </div>

            </div>

            <div class="row-content am-cf">


                <div class="row">

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">商品分类一级信息表 tips：分类图标只需上传一张图片</div>
                                <div class="widget-function am-fr">
                                    <a href="javascript:;" class="am-icon-cog"></a>
                                </div>
                            </div>
                            <div class="widget-body am-fr">

                                <form class="am-form tpl-form-line-form" method="post" enctype="multipart/form-data" action="/Admin/Sort/savesort?sort_id=<?php echo ($Sortdata["id"]); ?>">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">分类名称 <span class="tpl-form-line-small-title">SortName</span></label>
                                        <div class="am-u-sm-9">
                                            <input type="text" class="tpl-form-input" name="sortname" placeholder="请输入分类名称" value="<?php echo ($Sortdata["sortname"]); ?>">
                                            <small>请填写分类名称。</small>
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="user-email" class="am-u-sm-3 am-form-label">发布时间 <span class="tpl-form-line-small-title">Createdate</span></label>
                                        <div class="am-u-sm-9">
                                            <input type="text" class="am-form-field tpl-form-no-bg" placeholder="发布时间" data-am-datepicker="" readonly="" name="createdate" value="<?php echo ($Sortdata["createdate"]); ?>">
                                            <small>发布时间为必填</small>
                                        </div>
                                    </div>

                                    <div class="am-form-group">
                                        <label for="user-weibo" class="am-u-sm-3 am-form-label">分类图标 <span class="tpl-form-line-small-title">Images</span></label>
                                        <div class="am-u-sm-9">
                                            <div class="am-form-group ">
                                                <div class="tpl-form-file-img">
                                                     <ul data-am-widget="gallery" class="am-gallery am-avg-sm-3 am-avg-md-3 am-avg-lg-4 am-gallery-default" data-am-gallery="{ pureview: true }" id="imgshowlist">
                                                    <?php if(($Sortdata) == ""): else: ?>
                                                     <li style="position:relative;" >
                                                       <div class="am-gallery-item">
                                                           <a href="" class="">
                                                             <img src="<?php echo ($Sortdata["sortimgurl"]); ?>"  alt="" style="width:50px; height:50px; background:#fff"/>
                                                             <input type="hidden" name="imgs[]" value="<?php echo ($Sortdata["sortimgurl"]); ?>" />
                                                             <a class="am-close am-close-alt" onclick="delimg(this)" style="position:absolute; top:1px;left:45px; ">&times;</a>
                                                            </a>
                                                        </div>
                                                    </li><?php endif; ?>
                                
                                                 </ul>
                                                </div>
                                                <button type="button" class="am-btn am-btn-danger am-btn-sm" data-am-modal="{target: '#upload-modal', closeViaDimmer: 0, width: 700, height: 360}">
    <i class="am-icon-cloud-upload" ></i> 添加分类图标</button>
                                            </div>

                                        </div>
                                    </div>                                    

                                    <div class="am-form-group">
                                        <div class="am-u-sm-9 am-u-sm-push-3">
                                            <button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

        
         

            </div>
        </div>
    </div>
    </div>

      <!-- 模态窗口用于上传图片 -->
<div class="am-modal am-modal-no-btn" tabindex="-1" id="upload-modal">
              <div class="am-modal-dialog">
                         <div class="am-modal-hd">图片上传
                                       <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
                          </div>
                         <div class="am-modal-bd">
                                        <div id="demo" class="demo"></div>
                                        <div id="successinfo"></div>
                          </div>
            </div>
</div>
<!-- 模态窗口end -->
    <script src="/Public/admin/assets/js/amazeui.min.js"></script>
    <script src="/Public/admin/assets/js/amazeui.datatables.min.js"></script>
    <script src="/Public/admin/assets/js/dataTables.responsive.min.js"></script>
    <script src="/Public/admin/assets/js/app.js"></script>
<!-- 图片上传 -->
    <!-- 引用核心层插件 -->
<script type="text/javascript" src="/Public/tools/php_img_upload/core/zyFile.js"></script>
<!-- 引用控制层插件 -->
<script type="text/javascript" src="/Public/tools/php_img_upload/control/js/zyUpload.js"></script>

<script type="text/javascript" >
    
    $(function(){
    // 初始化插件
    var width = $(window).width();
    if ( width >= 650 )  width = '100%';
    else    width = "100%";

    $("#demo").zyUpload({
        width            :   width,                 // 宽度
        height           :   "auto",                 // 宽度
        itemWidth        :   "140px",                 // 文件项的宽度
        itemHeight       :   "100px",                 // 文件项的高度
        //url              :   "/upload/UploadAction",  // 上传文件的路径
        url              :   "/Admin/Upload/upSortImg",
        inputName        :  '_img[]',
        id               :   1,
        multiple         :   true,                    // 是否可以多个文件上传
        dragDrop         :   false,                    // 是否可以拖动上传文件
        del              :   true,                    // 是否可以删除文件
        finishDel        :   false,                   // 是否在上传文件完成后删除预览
        /* 外部获得的回调接口 */
        onSelect: function(selectFiles, allFiles){    // 选择文件的回调方法  selectFile:当前选中的文件  allFiles:还没上传的全部文件
            console.info("当前选择了以下文件：");
            console.info(selectFiles);
        },
        onProgress: function(file, loaded, total){    // 正在上传的进度的回调方法
            var eleProgress = $("#uploadProgress_" + file.index), percent = (loaded / total * 100).toFixed(2) + '%';
            eleProgress.html(percent);
            console.info(file.index);
            console.info("当前正在上传此文件：");
            console.info(file.name);
            console.info("进度等信息如下：");
            console.info(loaded);
            console.info(total);
        },   
        onDelete: function(file, files){              // 删除一个文件的回调方法 file:当前删除的文件  files:删除之后的文件
            console.info("当前删除了此文件：");
            console.info(file.name);
        },
        onSuccess: function(file, response){          // 文件上传成功的回调方法
            console.info("此文件上传成功：");
            $('#successinfo').append("<p>"+response+"</p>");
            console.info(response);
            var html= '<li style="position:relative">'
                           +'<div class="am-gallery-item">'
                               +'<a href="" class="">'
                                 +'<img src="'+response+'"  alt="" style="width:50px; height:50px; background:#fff"/>'
                                 +'<input type="hidden" name="imgs[]" value="'+response+'" />'
                                 +'<a class="am-close am-close-alt" onclick="delimg(this)" style="position:absolute; top:5px;left:45px; ">&times;</a>'
                                +'</a>'
                            +'</div>'
                          +'</li>' ;
            $('#imgshowlist').append(html);
            $('#upload-modal').modal('close');
            // alert(response);

        },
        onFailure: function(file, response){          // 文件上传失败的回调方法
            $("#uploadImage_" + file.index).css("opacity", 0.2);
            console.info("此文件上传失败：");
            console.info(file.name);
        },
        onComplete: function(response){               // 上传完成的回调方法
            console.info("文件上传完成");
            console.info(response);
        }
    });
    
});

</script>
<script>
            function delimg(obj){
                    $(obj).parents('li').remove();
            }

</script>

</body>

</html>